home *** CD-ROM | disk | FTP | other *** search
/ Cre@te Online 2000 December / Cre@teOnline CD05.iso / MacSoft / XML ConsoleMax.sea / XML ConsoleMax / Required / esc.jar / com / extensibility / xa / undo / InternalEntValueUndoable.class (.txt) < prev    next >
Encoding:
Java Class File  |  2000-06-30  |  2.8 KB  |  72 lines

  1. package com.extensibility.xa.undo;
  2.  
  3. import com.extensibility.app.UI;
  4. import com.extensibility.util.Debug;
  5. import com.extensibility.xa.EntityModel;
  6. import com.extensibility.xa.XADesktop;
  7. import com.extensibility.xml.BaseDeclaration;
  8. import com.extensibility.xml.EntityDeclaration;
  9. import com.extensibility.xml.InternalPEDeclaration;
  10. import com.extensibility.xml.ParserException;
  11.  
  12. public class InternalEntValueUndoable extends DeclTableUndoable {
  13.    EntityDeclaration entityDecl;
  14.  
  15.    public InternalEntValueUndoable(EntityModel var1, BaseDeclaration var2, Object var3) {
  16.       super(XADesktop.getTableForModel(var1), var2, var3);
  17.       this.entityDecl = (EntityDeclaration)var2;
  18.       super.oldValue = ((EntityModel)super.tableModel).getValueAt(super.tableModel.getRowForDecl(this.entityDecl), 3);
  19.    }
  20.  
  21.    public String getPresentationName() {
  22.       return ((EntityModel)super.tableModel).isGE() ? UI.getString("undo.ige.value") : UI.getString("undo.ipe.value");
  23.    }
  24.  
  25.    public void undo() {
  26.       super.undo();
  27.       this.entityDecl.setValue((String)super.oldValue);
  28.       if (this.entityDecl instanceof InternalPEDeclaration) {
  29.          this.updateModelAndAttrGroups((InternalPEDeclaration)this.entityDecl);
  30.       }
  31.  
  32.       ((DeclTableUndoable)this).setCellFocus(super.tableModel.getRowForDecl(this.entityDecl), 3);
  33.    }
  34.  
  35.    void updateModelAndAttrGroups(InternalPEDeclaration var1) {
  36.       if (var1.getContentModel() != null) {
  37.          try {
  38.             ((DeclTableUndoable)this).getSchemaDoc().setMuteDeclChanges(true);
  39.             ((DeclTableUndoable)this).getSchemaDoc().updateContentModel(var1, ((EntityDeclaration)var1).getValue());
  40.          } catch (ParserException var9) {
  41.             Debug.assert(var9);
  42.          } finally {
  43.             ((DeclTableUndoable)this).getSchemaDoc().setMuteDeclChanges(false);
  44.             var1.modelStateChanged(var1.getContentModel(), 31, super.oldValue);
  45.          }
  46.       }
  47.  
  48.       if (var1.getAttributeGroup() != null) {
  49.          try {
  50.             ((DeclTableUndoable)this).getSchemaDoc().updateAttributeGroup(var1, ((EntityDeclaration)var1).getValue());
  51.          } catch (ParserException var8) {
  52.             Debug.assert(var8);
  53.          }
  54.       }
  55.  
  56.    }
  57.  
  58.    public void doCommand() {
  59.       this.entityDecl.setValue((String)super.newValue);
  60.       if (this.entityDecl instanceof InternalPEDeclaration) {
  61.          this.updateModelAndAttrGroups((InternalPEDeclaration)this.entityDecl);
  62.       }
  63.  
  64.    }
  65.  
  66.    public void redo() {
  67.       super.redo();
  68.       this.doCommand();
  69.       ((DeclTableUndoable)this).setCellFocus(super.tableModel.getRowForDecl(this.entityDecl), 3);
  70.    }
  71. }
  72.